package com.lianbang.staff.module.main

import android.os.Bundle
import android.view.View
import cn.ubest.mvvmcore.base.BaseFragment
import cn.ubest.mvvmcore.utils.DoubleClickHelper
import com.lianbang.staff.BuildConfig
import com.lianbang.staff.R
import com.lianbang.staff.databinding.FragmentUserBinding
import com.lianbang.staff.module.user.AccountSafeActivity
import com.lianbang.staff.module.user.LoginActivity
import com.lianbang.staff.util.LoginUtils
import com.lianbang.staff.vm.MainVM
import kotlinx.android.synthetic.main.fragment_user.*

/**
 * Created by maoqi on 2020/12/28.
 */
class UserFragment : BaseFragment<MainVM, FragmentUserBinding>() {

    companion object {
        fun newInstance(): UserFragment {
            return UserFragment()
        }
    }

    override fun initLayout(): Int {
        return R.layout.fragment_user
    }

    override fun initData(arguments: Bundle?) {
    }

    override fun initView(view: View) {
        tv_toolbar_title.text = "系统设置"
        tv_version.text = "版本${BuildConfig.VERSION_NAME}"
        btn_account_safe.setOnClickListener(object : DoubleClickHelper.OnClickListener() {
            override fun onClicked(view: View?) {
                AccountSafeActivity.start(activity)
            }

        })
        btn_notify.setOnClickListener(object : DoubleClickHelper.OnClickListener() {
            override fun onClicked(view: View?) {
            }

        })
        btn_check_update.setOnClickListener(object : DoubleClickHelper.OnClickListener() {
            override fun onClicked(view: View?) {
            }

        })
        btn_switch_account.setOnClickListener(object : DoubleClickHelper.OnClickListener() {
            override fun onClicked(view: View?) {
            }

        })
        btn_login_out.setOnClickListener(object : DoubleClickHelper.OnClickListener() {
            override fun onClicked(view: View?) {
                LoginUtils.loginOut()
                LoginActivity.start(activity)
                activity?.finish()
            }

        })
    }

    override fun loadData() {
    }

}